home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 April / PCWorld_2008-04_cd.bin / v cisle / allwaysync / allwaysync-7-0-1.exe / {app} / Skins / default / animations.js < prev    next >
Text File  |  2007-04-02  |  2KB  |  71 lines

  1. function opacity(id, opacStart, opacEnd, millisec) {
  2.     //speed for each frame
  3.     var speed = Math.round(millisec / 100);
  4.     var timer = 0;
  5.  
  6.     //determine the direction for the blending, if start and end are the same nothing happens
  7.     if(opacStart > opacEnd) {
  8.         for(i = opacStart; i >= opacEnd; i--) {
  9.             setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
  10.             timer++;
  11.         }
  12.     } else if(opacStart < opacEnd) {
  13.         for(i = opacStart; i <= opacEnd; i++)
  14.             {
  15.             setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
  16.             timer++;
  17.         }
  18.     }
  19. }
  20.  
  21. //change the opacity for different browsers
  22. function changeOpac(opacity, id) {
  23.     var object = document.getElementById(id).style; 
  24.     object.opacity = (opacity / 100);
  25.     object.MozOpacity = (opacity / 100);
  26.     object.KhtmlOpacity = (opacity / 100);
  27.     object.filter = "alpha(opacity=" + opacity + ")";
  28. }
  29.  
  30. function animate(){
  31.     setTimeout("opacity('logo', 0, 100, 500)",500);
  32.     setTimeout("move0();",2000);
  33.     
  34.     setTimeout("document.getElementById('ApplicationName').style.visibility = 'visible'",2200);
  35.     
  36.     setTimeout("move1();",5000);
  37.     setTimeout("opacity('logo_right', 100, 0, 100)",5000);
  38.     setTimeout("opacity('logo_right', 0, 100, 400)",5100);
  39.     setTimeout("document.getElementById('BannerSlogan').style.display = ''",6500);
  40.     setTimeout("document.getElementById('VersionInBanner').style.display = ''",6500);
  41. }
  42.  
  43. distance0 = 195; // 195
  44. speed0 = 19;
  45. bounce0 = 0;
  46.  
  47. function move0(){
  48.     document.getElementById("logo_left").style.left = distance0+"px"; //muove "logo_left" alla posizione i
  49.     document.getElementById("logo_right").style.right = distance0+"px"; //muove "logo_right" alla posizione i
  50.     speed0--;
  51.     distance0-= speed0;
  52.     if ((distance0 > 40)||(bounce0 < 10)) //se non Φ arrivato a destinazione...
  53.         setTimeout(move0,1); //riesegui ogni 1ms
  54.     if (distance0 <= 40) bounce0++;
  55. }
  56.  
  57. distance1 = 195; //195
  58. speed1 = 20;
  59. bounce1 = 0;
  60.  
  61. function move1(){
  62.     document.getElementById("logo_right").style.right = distance1+"px"; //muove "logo_right" alla posizione i
  63.     speed1--;
  64.     distance1+= speed1;
  65.     if ((distance1 < 240)||(bounce1 < 25)) //se non Φ arrivato a destinazione...
  66.         setTimeout(move1,1); //riesegui ogni 1ms
  67.     if (distance1 >= 240) bounce1++;
  68. }
  69.  
  70. window.attachEvent("onload", animate);
  71.